package com.stylefeng.guns.modular.system.warpper;

import java.text.DecimalFormat;
import java.util.Date;
import java.util.Map;

import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.util.DateUtil;

public class MyGpcHistoryWarpper extends BaseControllerWarpper{

	public MyGpcHistoryWarpper(Object list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
    	DecimalFormat df = new DecimalFormat("0.00");
		Date gBuyDate = ((Date)map.get("gBuyDate"));
		map.put("gBuyDate", DateUtil.format(gBuyDate, "yyyy-MM-dd"));
		
		Object gSellerDate = map.get("gSellerDate");
		if(gSellerDate != null){
			map.put("gSellerDate", DateUtil.format((Date)map.get("gSellerDate"), "yyyy-MM-dd"));
		}
		
		map.put("gZsz", df.format(Math.abs(((Double)map.get("gZsz") / 100000000))));
		
		Long gCcStatus = ((Long)map.get("gCcStatus"));
		if(gCcStatus == 1l){
			map.put("gCcStatus", "<font color='red'><b>持仓中</b></font>");
		}else{
			map.put("gCcStatus", "<font color='green'><b>已清仓</b></font>");
		}
		Double gQjzdf = (Double)map.get("gQjzdf");
		map.put("gQjzdf", (gQjzdf >0 ? "<font color='red'><b>"+df.format(gQjzdf)+"</b></font>" : "<font color='green'><b>"+df.format(gQjzdf)+"</b></font>"));
		String JGCYDType = ((String)map.get("gJgcydType"));
    	String font = "";
		if(JGCYDType.equals("不控盘")){
			font = "<font color='DimGray'><b>不控盘</b></font>";
		}else if(JGCYDType.equals("轻度控盘")){
			font = "<font color='BurlyWood'><b>轻度控盘</b></font>";
		}else if(JGCYDType.equals("中度控盘")){
			font = "<font color='Chocolate'><b>中度控盘</b></font>";
		}else{
			font = "<font color='Brown'><b>完全控盘</b></font>";
		}
		map.put("JGCYDType", font);
    }
    
}
